package com.dhcc.core.modules.system.controller;


import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.baomidou.mybatisplus.plugins.Page;
import com.dhcc.core.framework.base.controller.BaseController;
import com.dhcc.core.framework.result.R;
import com.dhcc.core.framework.result.page.PageFactory;
import com.dhcc.core.modules.system.entity.User;
import com.dhcc.core.modules.system.service.IAddressListService;
import com.dhcc.core.modules.system.warpper.UserWarpper;


/**
 * 通讯录
 * 
 * @ClassName: AddressListController
 * @Description: TODO
 * @author lf
 */
@Controller
@RequestMapping("${sys.backendPath}/addresslist")
public class AddressListController extends BaseController {

	private String PREFIX = "/backend/system/addresslist/";
	
	@Autowired
	private IAddressListService addressListService;

    /**
     * 跳转到通讯录列表首页
     */
    @RequestMapping("/info")
    public String mailInfo() {
        return PREFIX + "addresslist.html";
    }
	
    /**
     * 获取通讯录成员列表
     */
	@SuppressWarnings("unchecked")
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list(@RequestParam Map<String, Object> params) {
		Page<User> page = new PageFactory<User>().defaultPage();
        List<Map<String, Object>> result = this.addressListService.list(page,params);
        page.setRecords((List<User>) new UserWarpper(result).warp());
        return R.packForBT(page);
    }

}
